#include<iostream>
#include<cstdio>
using namespace std;
int n,q,s[210000],p[210000];
int fun(int x){
	for(int i=1;i<=n;i++){
		p[i]=s[i];
		for(int j=i;j>=2;j--){
			if(p[j]<p[j-1]){
				if(j==x){
					x=j-1;
				}
				else if(j-1==x){
					x=j;
				}
				int t=p[j];
				p[j]=p[j-1];
				p[j-1]=t;
			}
		}
	}
	return x;
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout); 
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;i++){
		scanf("%d",&s[i]);
	}
	int a,b,c;
	for(int i=1;i<=q;i++){
		scanf("%d",&a);
		if(a==1){
			scanf("%d%d",&b,&c);
			s[b]=c;
		}
		if(a==2){
			scanf("%d",&b);
			printf("%d\n",fun(b)); 
		}
	}
	return 0;
}
